package com.blog.common.newclass.dostringabs;

import com.blog.common.newclass.inteface.DoStr;
import org.apache.shiro.crypto.hash.Md5Hash;

/**
 * 加密：隐藏字符串后面四个字符
 */
public class DoEntryShiroMd5 extends DoEntryAbs {

    public DoEntryShiroMd5(DoStr doStr){
        super(doStr);
    }
    public String salt = Long.toString(System.currentTimeMillis());
    public int hashTimes = 2;

    @Override
    public String getStr() throws Exception {
        Md5Hash md5Hash = new Md5Hash(super.getStr(),salt,hashTimes);
        return md5Hash.toString();
    }

    @Override
    public int cost() {
        return super.cost()+1;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public int getHashTimes() {
        return hashTimes;
    }

    public void setHashTimes(int hashTimes) {
        this.hashTimes = hashTimes;
    }
}